package phoenixAAD.WifiFlashDrive;


/**
 * 3.1.2 Data Structure<br>
 * The type of structure the data should be in<br><br>
 * Default: FILE
 */
public enum DataStructure{
	/**
	 * In file-structure there is no internal structure and the file is considered to be a continuous sequence of data bytes.
	 */
	FILE,
	/**
	 * In record-structure the file is made up of sequential records. <br>
	 * Record structure is REQUIRED only for hosts whose file systems support record structure.<br>
	 * by RFC 1123 4.1.2.13
	 */
	@Deprecated
	RECORD,
	/**
	 * Out of scope, not implemented
	 */
	@Deprecated
	PAGE;
	
	/**
	 * Converts the character into the corresponding enum
	 * @throws NotImplementedException the specified data structure is not implemented
	 * @throws SyntaxException bad argument was passed
	 */
	public static DataStructure getStructure(char representation) throws NotImplementedException, SyntaxException
	{
		representation = Character.toUpperCase(representation);
		switch(representation)
		{
		case 'F':
			return FILE;
		case 'R':
			throw new NotImplementedException(Response.ARGUMENT_NOT_IMPLEMENTED);
		case 'P':
			throw new NotImplementedException(Response.ARGUMENT_NOT_IMPLEMENTED);
		default:
			throw new SyntaxException(Response.BAD_ARGUMENT);
		}
	}
}